cmake_minimum_required(VERSION 2.4.6)
include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)

# Set the build type.  Options are:
#  Coverage       : w/ debug symbols, w/o optimization, w/ code-coverage
#  Debug          : w/ debug symbols, w/o optimization
#  Release        : w/o debug symbols, w/ optimization
#  RelWithDebInfo : w/ debug symbols, w/ optimization
#  MinSizeRel     : w/o debug symbols, w/ optimization, stripped binaries
#set(ROS_BUILD_TYPE RelWithDebInfo)
#set(ROS_BUILD_TYPE RelWithDebInfo)
#SET(CMAKE_CXX_FLAGS "-O3 -g -Wall")

#rosbuild_init()

set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)

#find_package( g2o REQUIRED)
#include_directories(${EIGEN_INCLUDE_DIRS})

find_package(PCL 1.7 REQUIRED)
include_directories(${PCL_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})

link_directories(${LIBRARY_OUTPUT_PATH})

#find_package(Eigen3 REQUIRED)
#include_directories(${EIGEN_INCLUDE_DIRS})

include_directories(/usr/local/include/opencv2)
include_directories(/usr/local/include/opencv)
include_directories(/usr/local/include/g2o)
link_directories(/usr/local/lib)

add_library(graph src/graph/VertexCamera.cpp src/graph/VertexPlane.cpp src/graph/VertexPoint3D.cpp src/graph/EdgeCameraPlane.cpp)
add_library(FeatureDescriptor src/FeatureDescriptor.cpp src/SurfFeatureDescriptor64.cpp src/SurfFeatureDescriptor128.cpp src/OrbFeatureDescriptor.cpp src/FPFHFeatureDescriptor.cpp src/IntegerHistogramFeatureDescriptor.cpp src/FloatHistogramFeatureDescriptor.cpp)
add_library(mygeometry src/Point.cpp src/Line.cpp src/Plane.cpp src/KeyPoint.cpp src/KeyPointSet.cpp)

add_library(association src/Association.cpp src/AssociationSet.cpp src/KeyPointAssociation.cpp src/PlaneAssociation.cpp src/KeyPointSet.cpp)
target_link_libraries(association mygeometry)

add_library(RGBDSegmentation src/RGBDSegmentation.cpp)

#rosbuild_add_executable(frame_asso src/frame_asso.cpp)

#rosbuild_add_executable(freib_test src/freib_test.cpp)
#target_link_libraries  (freib_test ${PCL_LIBRARIES})
#TARGET_LINK_LIBRARIES  (freib_test ${OpenCV_LIBS})
#TARGET_LINK_LIBRARIES  (freib_test opencv_calib3d opencv_core opencv_flann opencv_highgui opencv_legacy opencv_nonfree opencv_photo opencv_ts opencv_videostab opencv_contrib opencv_features2d opencv_gpu  opencv_imgproc opencv_ml opencv_objdetect opencv_stitching opencv_video)
#target_link_libraries  (freib_test g2o_cli g2o_core g2o_incremental g2o_interactive g2o_interface g2o_math_groups g2o_parser g2o_solver_cholmod g2o_solver_csparse g2o_solver_dense g2o_solver_pcg g2o_stuff g2o_types_icp g2o_types_sba g2o_types_sim3 g2o_types_slam2d g2o_types_slam3d)

#rosbuild_add_executable(analyze_output src/analyze_output.cpp)
#target_link_libraries  (analyze_output ${PCL_LIBRARIES})
#TARGET_LINK_LIBRARIES  (analyze_output ${OpenCV_LIBS})
#TARGET_LINK_LIBRARIES  (analyze_output opencv_calib3d opencv_core opencv_flann opencv_highgui opencv_legacy opencv_nonfree opencv_photo opencv_ts opencv_videostab opencv_contrib opencv_features2d opencv_gpu  opencv_imgproc opencv_ml opencv_objdetect opencv_stitching opencv_video)
#target_link_libraries  (analyze_output g2o_cli g2o_core g2o_incremental g2o_interactive g2o_interface g2o_math_groups g2o_parser g2o_solver_cholmod g2o_solver_csparse g2o_solver_dense g2o_solver_pcg g2o_stuff g2o_types_icp g2o_types_sba g2o_types_sim3 g2o_types_slam2d g2o_types_slam3d)

add_executable(ndttest src/ndttest.cpp)
target_link_libraries(ndttest ${PCL_LIBRARIES})

rosbuild_add_executable(evaluate_registration src/evaluate_registration.cpp)
target_link_libraries(evaluate_registration ${PCL_LIBRARIES})
target_link_libraries(evaluate_registration ${OpenCV_LIBS})
target_link_libraries(evaluate_registration graph)
target_link_libraries(evaluate_registration mygeometry)
target_link_libraries(evaluate_registration FeatureDescriptor)
target_link_libraries(evaluate_registration association)
target_link_libraries(evaluate_registration RGBDSegmentation)

target_link_libraries(evaluate_registration g2o_cli g2o_core g2o_incremental g2o_interactive g2o_interface g2o_math_groups g2o_parser g2o_solver_cholmod g2o_solver_csparse g2o_solver_dense g2o_solver_pcg g2o_stuff g2o_types_icp g2o_types_sba g2o_types_sim3 g2o_types_slam2d g2o_types_slam3d)
target_link_libraries(evaluate_registration opencv_calib3d opencv_core opencv_flann opencv_highgui opencv_legacy opencv_nonfree opencv_photo opencv_ts opencv_videostab opencv_contrib opencv_features2d opencv_gpu  opencv_imgproc opencv_ml opencv_objdetect opencv_stitching opencv_video)

rosbuild_add_executable(kinect_at_home_test src/kinect_at_home_test.cpp)
target_link_libraries(kinect_at_home_test ${PCL_LIBRARIES})
target_link_libraries(kinect_at_home_test ${OpenCV_LIBS})
target_link_libraries(kinect_at_home_test graph)
target_link_libraries(kinect_at_home_test mygeometry)
target_link_libraries(kinect_at_home_test FeatureDescriptor)
target_link_libraries(kinect_at_home_test association)
target_link_libraries(kinect_at_home_test RGBDSegmentation)
target_link_libraries(kinect_at_home_test g2o_cli g2o_core g2o_incremental g2o_interactive g2o_interface g2o_math_groups g2o_parser g2o_solver_cholmod g2o_solver_csparse g2o_solver_dense g2o_solver_pcg g2o_stuff g2o_types_icp g2o_types_sba g2o_types_sim3 g2o_types_slam2d g2o_types_slam3d)
target_link_libraries(kinect_at_home_test opencv_calib3d opencv_core opencv_flann opencv_highgui opencv_legacy opencv_nonfree opencv_photo opencv_ts opencv_videostab opencv_contrib opencv_features2d opencv_gpu  opencv_imgproc opencv_ml opencv_objdetect opencv_stitching opencv_video)

rosbuild_add_executable(bow_setup src/bow_setup.cpp)
target_link_libraries(bow_setup ${PCL_LIBRARIES})
target_link_libraries(bow_setup ${OpenCV_LIBS})
target_link_libraries(bow_setup graph)
target_link_libraries(bow_setup mygeometry)
target_link_libraries(bow_setup FeatureDescriptor)
target_link_libraries(bow_setup association)
target_link_libraries(bow_setup RGBDSegmentation)

target_link_libraries(bow_setup g2o_cli g2o_core g2o_incremental g2o_interactive g2o_interface g2o_math_groups g2o_parser g2o_solver_cholmod g2o_solver_csparse g2o_solver_dense g2o_solver_pcg g2o_stuff g2o_types_icp g2o_types_sba g2o_types_sim3 g2o_types_slam2d g2o_types_slam3d)
target_link_libraries(bow_setup opencv_calib3d opencv_core opencv_flann opencv_highgui opencv_legacy opencv_nonfree opencv_photo opencv_ts opencv_videostab opencv_contrib opencv_features2d opencv_gpu  opencv_imgproc opencv_ml opencv_objdetect opencv_stitching opencv_video)


#rosbuild_add_executable(slam_node src/slam_node.cpp)
#target_link_libraries(slam_node ${PCL_LIBRARIES})
#target_link_libraries(slam_node g2o_cli g2o_core g2o_incremental g2o_interactive g2o_interface g2o_math_groups g2o_parser g2o_solver_cholmod g2o_solver_csparse g2o_solver_dense g2o_solver_pcg g2o_stuff g2o_types_icp g2o_types_sba g2o_types_sim3 g2o_types_slam2d g2o_types_slam3d)
#TARGET_LINK_LIBRARIES(slam_node ${OpenCV_LIBS})
#TARGET_LINK_LIBRARIES(slam_node opencv_calib3d opencv_core opencv_flann opencv_highgui opencv_legacy opencv_nonfree opencv_photo opencv_ts opencv_videostab opencv_contrib opencv_features2d opencv_gpu  opencv_imgproc opencv_ml opencv_objdetect opencv_stitching opencv_video)

#rosbuild_add_executable(test_mapping src/test_mapping.cpp)
#target_link_libraries(test_mapping ${PCL_LIBRARIES})
#target_link_libraries(test_mapping graph)
#target_link_libraries(test_mapping mygeometry)
#target_link_libraries(test_mapping FeatureDescriptor)
#target_link_libraries(test_mapping association)
#target_link_libraries(test_mapping RGBDSegmentation)

#target_link_libraries(test_mapping g2o_cli g2o_core g2o_incremental g2o_interactive g2o_interface g2o_math_groups g2o_parser g2o_solver_cholmod g2o_solver_csparse g2o_solver_dense g2o_solver_pcg g2o_stuff g2o_types_icp g2o_types_sba g2o_types_sim3 g2o_types_slam2d g2o_types_slam3d)
#TARGET_LINK_LIBRARIES(test_mapping ${OpenCV_LIBS})
#TARGET_LINK_LIBRARIES(test_mapping opencv_calib3d opencv_core opencv_flann opencv_highgui opencv_legacy opencv_nonfree opencv_photo opencv_ts opencv_videostab opencv_contrib opencv_features2d opencv_gpu  opencv_imgproc opencv_ml opencv_objdetect opencv_stitching opencv_video)

#rosbuild_add_executable(bow_setup src/bow_setup.cpp)
#target_link_libraries(bow_setup ${PCL_LIBRARIES})
